package com.tbit.uqbike.webmanager.controller;

import com.tbit.uqbike.object.pojo.WeiXinPushModel;
import com.tbit.common.entity.view.Result;
import com.tbit.uqbike.service.business.WeiXinPushModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * 微信小程序服务推送配置
 *
 * @Author:BUGTian
 * @DATE: 2022/7/21
 */
@RestController
@RequestMapping("/weiXinPushConfig")
public class WeiXinPushModelController {

    @Autowired
    private WeiXinPushModelService weiXinPushModelService;

    /**
     * 查询微信小程序服务推送配置
     *
     * @param type      推送类型(0关锁成功通知、1月卡到期通知、2订单即将结束提醒、3车辆违规提醒)
     * @param accountId 品牌id
     * @return
     */
    @GetMapping("/queryWeiXinPushModel")
    public Result<WeiXinPushModel> queryWeiXinPushModel(@NotNull Integer type, @NotNull Integer accountId) {
        return weiXinPushModelService.queryWeiXinPushModel(type, accountId);
    }

    /**
     * 修改微信小程序服务推送配置
     *
     * @return
     */
    @PostMapping("/editWeiXinPushModel")
    public Result editWeiXinPushModel(@RequestBody WeiXinPushModel weiXinPushModel) {
        return weiXinPushModelService.editWeiXinPushModel(weiXinPushModel);
    }
}
